<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/11/12
 * Time: 14:52
 */

namespace fastphp\base;


class Model extends Sql
{
    protected $model;

    public function __construct()
    {
        // 获取数据库表名
        if (!$this->table) {

            // 获取模型类名称
            $this->model = get_class($this);

            // 删除类名最后的 Model 字符
            $this->model = substr($this->model, 0, -5);

            $temp_name = explode('\\',strtolower($this->model));

            // 数据库表名与类名一致
            $this->table = array_pop($temp_name);;
        }
    }
}